package com.fruit.alipay.util;

import com.alipay.api.domain.AlipayTradeOrderMobilepayModel;
import com.alipay.api.internal.util.json.JSONWriter;
import com.alipay.api.request.AlipayTradeAppPayRequest;

public class AlipayAppRequestBuilder {
    private AlipayTradeOrderMobilepayModel model   = new AlipayTradeOrderMobilepayModel();
    private AlipayTradeAppPayRequest       request = new AlipayTradeAppPayRequest();

    public AlipayTradeOrderMobilepayModel getModel() {
        return model;
    }

    public void setModel(AlipayTradeOrderMobilepayModel model) {
        this.model = model;
    }

    public AlipayTradeAppPayRequest getRequest() {
        request.setBizContent(new JSONWriter().write(model, true));
        return request;
    }

    public void setRequest(AlipayTradeAppPayRequest request) {
        this.request = request;
    }

    public AlipayAppRequestBuilder setReturnUrl(String returnUrl) {
        request.setReturnUrl(returnUrl);
        return this;
    }

    public AlipayAppRequestBuilder setNotifyUrl(String notifyUrl) {
        request.setNotifyUrl(notifyUrl);
        return this;
    }

    public AlipayAppRequestBuilder setOutTradeNo(String outTradeNo) {
        model.setOutTradeNo(outTradeNo);
        return this;
    }

    public AlipayAppRequestBuilder setTotalAmount(String totalAmount) {
        model.setTotalAmount(totalAmount);
        return this;
    }

    public AlipayAppRequestBuilder setSubject(String subject) {
        model.setSubject(subject);
        return this;
    }

    public AlipayAppRequestBuilder setBody(String body) {
        model.setBody(body);
        return this;
    }

    public AlipayAppRequestBuilder setSellerId(String sellerId) {
        model.setSellerId(sellerId);
        return this;
    }

    public AlipayAppRequestBuilder setTimeoutExpress(String timeoutExpress) {
        model.setTimeoutExpress(timeoutExpress);
        return this;
    }

    public AlipayAppRequestBuilder setAuthToken(String authToken) {
        model.setAuthToken(authToken);
        return this;
    }
    
    public AlipayAppRequestBuilder setProductCode(String productCode){
    	model.setProductCode(productCode);
    	return this;
    }
}
